﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RMS.EF.Model
{
    [MetadataType(typeof(RMS_Role_Metadata))]
    public partial class RMS_Role
    {
        /// <summary>
        /// 删除状态
        /// </summary>
        [NotMapped]
        public E_Deleted EDeleted
        {
            get
            {
                if (!this.Deleted.HasValue)
                {
                    this.Deleted = (int)E_Deleted.Normal;
                }
                return (E_Deleted)this.Deleted.Value;
            }
            set
            {
                this.Deleted = (int)value;
            }
        }

        /// <summary>
        /// 是否可用
        /// </summary>
        [NotMapped]
        public E_Status EStatus
        {
            get
            {
                if (!this.Status.HasValue)
                {
                    this.Status = (int)E_Status.Disable;
                }
                return (E_Status)this.Status.Value;
            }
            set
            {
                this.Status = (int)value;
            }
        }
    }
    internal class RMS_Role_Metadata
    {

        [Required(AllowEmptyStrings = false, ErrorMessage = "请输入名称")]//必填
        public string Name { get; set; }
        [DataType(DataType.Text)]
        [RegularExpression(@"^-?\d+$", ErrorMessage = "请输入整数")]//正则表达式验证
        public int? Ordering { get; set; }
        [Required(AllowEmptyStrings = false, ErrorMessage = "请告知操作人")]//必填
        public string LastUpdateUser { get; set; }
    }
}
